import { Component, OnInit } from '@angular/core';
import { ImageProcessType } from '@utils/image-process/image-process-type.enum';
import { ProcessMenuTreeNode } from '../models/process-menu-tree-node';
import { ImageProcessMenuService } from '../services/image-process-menu.service';

@Component({
  selector: 'zlyt-process-type-select',
  templateUrl: './process-type-select.component.html',
  styleUrls: ['./process-type-select.component.scss']
})
export class ProcessTypeSelectComponent implements OnInit {

  public activeItem = ''
  public menus: ProcessMenuTreeNode[] = [];
  constructor(private processMenuService: ImageProcessMenuService) { }

  ngOnInit(): void {
    this.menus = this.processMenuService.processMenus;
  }

  handleItemClick(type: ImageProcessType | null) {
    if (this.activeItem === type) {
      this.activeItem = '';
    } else {
      this.activeItem = type || '';
    }
  }

}
